home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / Development Kits / USBDDK_v1.0.1_updated / Examples / CompositeClassDriver / CompositeClassDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-29  |  2.2 KB  |  75 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CompositeClassDriver.h
  3.  
  4.     Contains:    Header file for Composite Class Driver 
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __CompositeCLASSDRIVERH__
  12. #define __CompositeCLASSDRIVERH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <USB.h>
  19.  
  20. Boolean        immediateError(OSStatus err);
  21. void        CompositeDeviceInitiateTransaction(USBPB *pb);
  22. void        CompositeDeviceCompletionProc(USBPB *pb);
  23. void         InitParamBlock(USBDeviceRef theDeviceRef, USBPB * paramblock);
  24.  
  25. OSStatus    CompositeDriverInitInterface(UInt32 interfaceNum, USBInterfaceDescriptor *interfaceDesc, USBDeviceDescriptor *deviceDesc, USBDeviceRef device);
  26. OSStatus    CompositeDriverNotifyProc(UInt32 notification, void *pointer);
  27. OSStatus    CompositeDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc);
  28. OSStatus    CompositeDriverInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  29. OSStatus    CompositeDriverFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  30.  
  31. void        DeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDeviceDescriptor, UInt32 busPowerAvailable);
  32.  
  33. OSErr        GetInterfaceDescriptor(LogicalAddress pConfigDesc, UInt32 ReqInterface, USBInterfaceDescriptorPtr *hInterfaceDesc);
  34.  
  35. #define     kCompositeRetryCount    5
  36.  
  37. enum driverstates
  38. {
  39.     kUndefined = 0,
  40.     kSetConfig,
  41.     kGetFullConfiguration0,
  42.     kGetFullConfiguration1,
  43.     kNewInterfaceRef,
  44.     kExitDriver =             0x1000,
  45.     kRetryTransaction =     0x2000,
  46.     kSyncTransaction =         0x4000,
  47.     kCompletionPending =     0x8000
  48. };
  49.  
  50. typedef struct
  51. {
  52.     USBPB                             pb;
  53.     void (*handler)(USBPB             *pb);
  54.  
  55.     USBDeviceRef                    deviceRef;
  56.     
  57.     Boolean                            disposeCompletedFlag;
  58.     Boolean                            okayToFinalizeFlag;
  59.     
  60.     USBDeviceDescriptor             deviceDescriptor;
  61.     USBConfigurationDescriptor        partialConfigDescriptor;
  62.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  63.     
  64.     USBInterfaceDescriptor            interfaceDescriptors[32];
  65.     USBInterfaceRef                    interfaceRefArray[32];
  66.     USBRqIndex                        interfaceCount;
  67.     USBRqIndex                        interfaceIndex;
  68.     
  69.     SInt32                             retryCount;
  70.     SInt32                            delayLevel;
  71.     SInt32                            transDepth;
  72.     UInt32                            busPowerAvailable;
  73. } usbCompositePBStruct;
  74.  
  75. #endif //__CompositeCLASSDRIVERH__